package com.wuxiaofan.coupon.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.coupon.entity.SmsSkuLadder;
import com.wuxiaofan.coupon.entity.custom.SmsSkuLadderCustom;
import com.wuxiaofan.coupon.mapper.SmsSkuLadderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.coupon.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SmsSkuLadderService {
    @Autowired
    private SmsSkuLadderMapper smsSkuLadderMapper;
    @Resource
    private Idgenerator idgenerator;
    public SmsSkuLadder findById(String id){
        return smsSkuLadderMapper.selectById(id);
    }

    public SmsSkuLadderCustom findCountByMap(Map paraMap){
        return smsSkuLadderMapper.findCountByMap(paraMap);
    }

    public SmsSkuLadderCustom findGroupByMap(Map paraMap){
        return smsSkuLadderMapper.findGroupByMap(paraMap);
    }

    public List<SmsSkuLadderCustom> findByMap(Map paraMap){
        return smsSkuLadderMapper.findByMap(paraMap);
    }

    public Page<SmsSkuLadderCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(smsSkuLadderMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        smsSkuLadderMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        smsSkuLadderMapper.deleteById(id);
    }

    public SmsSkuLadder save(SmsSkuLadder smsSkuLadder){
        smsSkuLadder.setId(idgenerator.getId());
        smsSkuLadderMapper.insert(smsSkuLadder);
        return smsSkuLadder;
    }

}
